﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace WebApplication1
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {

            routes.MapMvcAttributeRoutes();//注册启用特性路由


            //如果用户发送以“.axd”为结束的请求，将不会有任何路径加载的操作，请求将直接定位到物理资源。
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            //routes.MapRoute("simple","{first}/{second}/{third}");
            //设置默认的Controller为Home;默认的action为Index;设置id的值为URL的一个参数值(可选参数)。 
            //routes.MapRoute("simple", "{controller}/{action}/{id}", new {controller = "home", id = UrlParameter.Optional, action = "Index" });

            routes.MapRoute(
                name: "Upload",
                url: "Employee/BulkUpload",
                defaults: new { controller = "BulkUpload", action = "Index" }
            );

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );
        }
    }
}
